package com.aixingfu.sports.Adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.aixingfu.sports.Model.OrderListModel;
import com.aixingfu.sports.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.vondear.rxtool.RxTimeTool;

import java.util.List;

/**
 * Author : lv
 * Time : 2019.05.27 0011
 * Description :
 */
public class OrderListAdapter extends BaseQuickAdapter<OrderListModel.DataBeanX.DataBean, BaseViewHolder> {

    private Context context;

    public OrderListAdapter(int layoutResId, @Nullable List<OrderListModel.DataBeanX.DataBean> data) {
        super(layoutResId, data);
    }

    public OrderListAdapter(Context context, int layoutResId, @Nullable List<OrderListModel.DataBeanX.DataBean> data) {
        super(layoutResId, data);

        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderListModel.DataBeanX.DataBean item) {
        helper.setText(R.id.tv_member_name,item.getMemberName())
                .setText(R.id.tv_contract_number,item.getDeal_number())
        .setText(R.id.tv_money,item.getTotalPrice())
        .setText(R.id.tv_sellers,item.getEmployeeName())
        .setText(R.id.tv_selling_venues,item.getVenueName())
        .setText(R.id.tv_date,RxTimeTool.stampToDate(item.getCreate_at()));
        String type = item.getType();
        if ("1".equals(type)){
            helper.setText(R.id.tv_type,"购卡合同");
        }else if ("2".equals(type)){
            helper.setText(R.id.tv_type,"购课合同");
        }
        String is_really = item.getIs_really();
        if ("0".equals(is_really)){
            helper.setText(R.id.tv_state,"未审核");
        }else if ("1".equals(is_really)){
            helper.setText(R.id.tv_state,"已审核");
        }
    }
}
